package com.team.communication;

public enum ServerRequest {
	//init request
	INITCON("init_conection"),//ok
	ACK("acknoledge"),//ok
	
	//created or join Game
	SEND_GAMES("send_games"),//ok
	GAME_CREATION_OK("game_creation_ok"),//ok
	GAME_NAME_ALREADY_USED("game_name_already_used"),//ok
	GAME_JOIN_OK("game_join_ok"),
	GAME_FULL("game_full"),
	PAWN_OK("pawn_ok"),//ok
	PAWN_ALREADY_USED("pawn_already_used"),//ok
	PAWN_CHOSEN("pawn_chosen"),//ok
	
	
	SEND_CARD("send_card"), // for dealing, ok
	
	IT_IS_THE_TURN_OF("it_is_the_turn_of"),//ok
	ASK_SUGGESTED_CARDS("ask_suggested_cards"),//ok
	SEND_ASKED_CARD("send_asked_card"), //ok
	
	SEND_DIRECTION("send_direction"), //ok
	SEND_MAKE_SUGGESTION("send_make_suggestion"), //ok
	SUGGESTED_CARD("suggested_card"), //ok
	SEND_NO_ASKED_CARD("send_no_asked_card"), 
	CHOOSE_CHARACTER("choose_character");//ok
	
	private String description;

	private ServerRequest(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	public static ServerRequest getServerRequestFromDescription(String description) {
		
		
		if(description.equals("init_conection")) {
			return INITCON;
		}else if(description.equals("send_games")) {
			return SEND_GAMES; 
		}else if(description.equals("send_make_suggestion")) {
			return SEND_MAKE_SUGGESTION;
		}else if(description.equals("suggested_card")) {
			return SUGGESTED_CARD;
		}
		else if(description.equals("send_no_asked_card")) {
			return SEND_NO_ASKED_CARD;
		}else if(description.equals("game_creation_ok")) {
			return GAME_CREATION_OK;
		}else if(description.equals("game_name_already_used")) {
			return GAME_NAME_ALREADY_USED;
		}else if(description.equals("game_join_ok")) {
			return GAME_JOIN_OK;
		}else if(description.equals("game_full")) {
			return GAME_FULL;
		}else if(description.equals("pawn_ok")) {
			return PAWN_OK;
		}else if(description.equals("pawn_already_used")) {
			return PAWN_ALREADY_USED;
		}else if(description.equals("pawn_chosen")) {
			return PAWN_CHOSEN;
		}else if(description.equals("send_card")) {
			return SEND_CARD;
		}else if(description.equals("it_is_the_turn_of")) {
			return IT_IS_THE_TURN_OF;
		}else if(description.equals("ask_suggested_cards")) {
			return ASK_SUGGESTED_CARDS;
		}else if(description.equals("send_asked_card")) {
			return SEND_ASKED_CARD;
		}else if(description.equals("send_direction")) {
			return SEND_DIRECTION;
		}else if(description.equals("choose_character")) {
			return CHOOSE_CHARACTER;
		}else if(description.equals("acknoledge")) {
			return ACK;
		}
		
		else {
			return null;
		}
	}
}
